<?php


namespace app\model;


use think\Model;

class SizeModel extends Model
{
    protected $table = "store_size";

    /**
     * @param $param
     * @return SizeModel[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     * @notes 尺寸列表
     * @author: dongdong
     * @date: 2025/1/7 15:40
     */
    public static function lists($param){
        $where = [];
        $where['status'] = 1;
        if($param['transport_way']){
            $where['transport_way'] = $param['transport_way'];
        }
        return self::where($where)->field("id,title,title_ru")->select();
    }

    /**
     * @param $id
     * @return SizeModel|array|mixed|Model|null
     * @notes 尺寸详情
     * @author: dongdong
     * @date: 2025/1/8 14:42
     */
    public function info($id){
        try {
            return self::where("id=$id")->field("id,title,title_ru")->find();
        }catch (\Exception $e){
            return [];
        }
    }

}